home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / kernel / Include / netInterface.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-09-13  |  2.4 KB  |  69 lines

  1. /*
  2.  * header.h --
  3.  *
  4.  *    This defines the types and constants for the network interfaces.
  5.  *
  6.  * Copyright 1990 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  * $Header: /sprite/src/kernel/net/RCS/netInterface.h,v 1.1 90/10/02 12:00:18 jhh Exp $ SPRITE (Berkeley)
  16.  */
  17.  
  18. #ifndef _NETINTERFACE
  19. #define _NETINTERFACE
  20.  
  21. #include <syncTypes.h>
  22.  
  23. /*
  24.  * Structure that defines a network interface.
  25.  */
  26.  
  27. typedef struct Net_Interface {
  28.     char        *name;        /* Name of the interface. */
  29.     int             unit;        /* Unit number of device. */
  30.     Address        ctrlAddr;    /* Address of control register. */
  31.     Boolean        virtual;    /* Is ctrlAddr in kernel VM? */
  32.     int            vector;        /* Interrupt vector generated by 
  33.                      * device. */
  34.     ReturnStatus    (*init)();    /* Initialization routine. */
  35.     void         (*output)();    /* Output a packet. */
  36.     void         (*intr)();    /* Handle an interrupt. */
  37.     void         (*reset)();    /* Reset the interface */
  38.     ReturnStatus    (*ioctl)();    /* Perform ioctls on interface. */
  39.     ReturnStatus    (*getStats)();    /* Get performance statistics. */
  40.     int            number;        /* Interface number. */
  41.     Net_NetworkType    netType;    /* Type of interface. See below. */
  42.     int            flags;        /* Status flags. See below. */
  43.     Sync_Semaphore    syncOutputMutex;/* Used to wait for packets
  44.                      * to be output. */
  45.     Sync_Semaphore    mutex;        /* Protects network interface board
  46.                      * and related data structures. */
  47.     int            maxBytes;    /* Maximum transfer unit 
  48.                      * (packet size) */
  49.     int            minBytes;    /* Minimum transfer unit. */
  50.     void        (*packetProc)();/* Packet handler in dev module. */
  51.     ClientData        interfaceData;    /* Place for the interface routines
  52.                      * store store stuff. */
  53.     ClientData        devNetData;    /* Place for the network device
  54.                      * driver to store stuff. */
  55.     Net_Address        netAddress[NET_MAX_PROTOCOLS];
  56.     Net_Address        broadcastAddress; /* Broadcast address for this
  57.                        * interface. */
  58. } Net_Interface;
  59.  
  60. /*
  61.  * Flag values for Net_Interface.
  62.  */
  63.  
  64. #define NET_IFLAGS_RUNNING    0x1    /* The interface is active. */
  65. #define NET_IFLAGS_BROADCAST    0x2    /* Interface supports broadcast. */
  66.  
  67. #endif /* _NETINTERFACE */
  68.  
  69.